<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style>
        html,
        body,
        #mapui {
            margin: 0 auto;
            width: 100%;
            height: 100%
        }

        html,
        body {
            margin: 0;
            overflow: hidden;
            background: #fff;
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
        }
    </style>

</head>

<body>
    <div id="mapui"></div>

    <script src="./js_thematic_map_example/script/jq/jquery.min.js"></script>
    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>
    <script>
        var echartsLayer = null;
        var option = null;
        var amap = null;
        var that = this;

        var uploadedDataURL = "./js_thematic_map_example/data/hangzhou-tracks.json";

        $.get(uploadedDataURL, function (data) {
            var points = [].concat.apply([], data.map(function (track) {
                return track.map(function (seg) {
                    return seg.coord.concat([1]);
                });
            }));

            option = {
                GLMap: {
                    roam: true
                },
                coordinateSystem: 'GLMap',
                visualMap: {
                    show: false,
                    top: 'top',
                    min: 0,
                    max: 5,
                    seriesIndex: 0,
                    calculable: true,
                    inRange: {
                        color: ['blue', 'blue', 'green', 'yellow', 'red']
                    }
                },

                series: [{
                    type: 'heatmap',
                    coordinateSystem: 'GLMap',
                    data: points,
                    pointSize: 5,
                    blurSize: 6
                }]
            };

            map.Factory.create('mapui', {
                center: [120.15, 30.24],
                fullExtent: {
                    xmin: 90.992204,
                    ymin: 10.979711,
                    xmax: 120.5338915,
                    ymax: 50.543712
                },
                zoom: 12,
                projection: 'EPSG:4326',
                strategy: ['mapboxgl', 'openlayers'],
            style: style
            }, (o) => {
                amap = o;
                map.Factory.loadSpecialMap('echarts', () => {
                that.init(amap.pmap);
            })
            });
        });

        function init(map) {
            echartsLayer = new EchartsLayer(map);
            echartsLayer.chart.setOption(option);
        }



    </script>
</body>

</html>